home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 6
/
Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso
/
001a
/
tlxutl10.zip
/
COPYCOL.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1991-01-25
|
3KB
|
120 lines
Program CopyColours;
{ Copyright 1991 By Reuben Sumner }
Uses
Dos;
Const
LookFor : Array [1..12] of String[10] =
('deffg','defbg','statfore','statback','bord','mbord','mbback',
'mfore','mbold','mback','mbar','msel');
{ This is an array of strings to search for in config file that indicate
that they are colours }
Label
AbortProgram;
Var
CColour, BColour, New : Text; { CColour : File with colours to copy
BColour : File to copy colours to
New : File to create with proper colours }
Correct, Wrong : PathStr; { Correct : File name with correct colours
Wrong : File name with incorrect colours }
Colours : Array [1..12] of Byte; { Array containing colours read in from
CColour }
FDir : DirStr;
FName : NameStr; { Strings for breaking up filenames }
FExt : ExtStr;
Line : String[80]; { Line to read in from files }
Count, Position : Byte; { Count : For loop purposes
Position : variable for location of = sign
and other }
Name : String[10]; { Name of line in config ie "bold" }
Value : String[40]; { Value for Name ie 10 or "ATDT" }
Error : Integer; { Result code for Val procedure }
Begin
If ParamCount > 0 Then
If ParamCount <> 2 Then
Begin
WriteLn ('Improper syntax!');
WriteLn;
WriteLn ('Correct syntax is:');
WriteLn ('COPYCOL [input[.CNF] output[.CNF]]');
Goto AbortProgram;
End
Else
Begin
Correct := ParamStr (1);
Wrong := ParamStr (2);
FSplit (Correct,FDir,FName,FExt);
If FExt = '' Then
FExt := '.CNF';
Correct := FDir + FName + FExt;
FSplit (Wrong,FDir,FName,FExt);
If FExt = '' Then
FExt := '.CNF';
Wrong := FDir + FName + FExt;
End
Else
Begin
Write ('Enter filename with correct colours: ');
ReadLn (Correct);
Write ('Enter filename with incorrect colours: ');
ReadLn (Wrong);
End;
Assign (CColour,Correct);
Assign (BColour,Wrong);
FSplit (Wrong,FDir,FName,FExt);
FExt := 'bak';
Assign (New,FDir+FName+'.'+FExt);
{$I-}
Erase (New);
{$I+}
Error := IOResult; { Never used but clears result code }
Assign (New,Wrong);
Reset (CColour);
Repeat
ReadLn (CColour,Line);
Count := 1;
Position := Pos ('=',Line);
Name := Copy (Line,1,Position-1);
Value := Copy (Line,Position+1,Length(Line)-Position);
Repeat
If Name = LookFor [Count] Then
Begin
Val (Value,Colours[Count],Error);
Count := 12;
End;
Inc (Count);
Until Count = 13;
Until Eof(CColour);
Close (CColour);
Reset (BColour);
Rewrite (New);
Repeat
ReadLn (BColour,Line);
Count := 1;
Position := Pos ('=',Line);
Name := Copy (Line,1,Position-1);
Value := Copy (Line,Position+1,Length(Line)-Position);
Repeat
If Name = LookFor [Count] Then
Begin
Str (Colours [Count],Value);
Count := 12;
End;
Inc (Count);
Until Count = 13;
WriteLn (New,Name+'='+Value);
Until Eof(BColour);
Close (BColour);
Close (New);
AbortProgram:
End.